<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
a {color:#F90}
</style>
<?php
	$ms_mt = $_REQUEST['ms'];
	
	mysql_query("SET character_set_results=utf8");	
	$sql1 = "SELECT *,DATE_FORMAT(ngay_dang,'%d-%m-%Y %H:%i:%s') AS ngay FROM mau_tin_rv WHERE ms_mau_tin_rv = $ms_mt";
	$rs1 = mysql_query($sql1);
	$row1 = mysql_fetch_row($rs1);
	
	$ten_dn = $row1[1];
	$ms_muc_tin = $row1[2];
	$tieu_de = $row1[3];
	$noi_dung = $row1[4];
	$ngay_dang = $row1[12];
	$noi_dang = $row1[6];
	$hinh = $row1[7];
	$so_lan_xem = $row1[10];
	
	$sql = "SELECT * FROM thanh_vien WHERE ten_dn = '$ten_dn'";
	$rs = mysql_query($sql);
	$row = mysql_fetch_row($rs);
	$email = $row[3];
	$sdt = $row[4];
	$dia_chi = $row[5];
?>
<div class="form">
<table width="100%" cellpadding="5" cellspacing="0">
	<tr class="title_ds">
    	<td colspan="2"><?php echo $tieu_de ?></td>
    </tr>
    <tr>
    	<td valign="top"><textarea style="border:0" readonly="readonly" cols="48" rows="20"><?php echo $noi_dung ?></textarea></td>
        <td width="200" valign="top"><img src="uploads/<?php echo $hinh ?>" width="180" alt="No image"/></td>
    </tr>
</table>
<table width="100%" cellpadding="5" cellspacing="0">
    <tr class="title_ds">
    	<td colspan="2">Thông tin thêm</td>
    </tr>
    <tr>
    	<td align="right" width="50%">Người đăng: </td>
        <td><b><?php echo $ten_dn ?></b></td>
    </tr>
    <tr>
    	<td align="right" width="50%">Số điện thoại: </td>
        <td><b><?php echo $sdt ?></b></td>
    </tr>
    <tr>
    	<td align="right" width="50%">Email: </td>
        <td><b><?php echo $email ?></b></td>
    </tr>
    <tr>
    	<td align="right" width="50%">Địa chỉ: </td>
        <td><b><?php echo $dia_chi ?></b></td>
    </tr>
    <tr>
    	<td align="right" width="50%">Ngày đăng: </td>
        <td><b><?php echo $ngay_dang ?></b></td>
    </tr>
    <tr>
    	<td align="right" width="50%">Nơi đăng: </td>
        <td><b><?php echo $noi_dang ?></b></td>
    </tr>
    <tr>
    	<td align="right" width="50%">Số lượt xem: </td>
        <td><b><?php echo $so_lan_xem ?></b></td>
    </tr>
</table>
<table width="100%" cellspacing="1" cellpadding="5">
    <tr class="title_ds">
    	<td colspan="3">5 mẩu tin gần đây nhất của <font style="font-style:italic"><?php echo $ten_dn ?></font></td>
    </tr>
    <tr class="title_ds">
    	<td>Ngày đăng</td>
        <td>Tiêu đề</td>
        <td>Nơi đăng</td>
    </tr>
<?php
	$sql2 = "SELECT *, 
					 DATE_FORMAT(ngay_dang,'%d-%m-%Y') AS ngay FROM mau_tin_rv
			  WHERE ten_dn = '$ten_dn'
			  AND giay_phep = '1'
			  ORDER BY vip DESC, ngay_dang DESC 
			  LIMIT 0,5";
	$rs2 = mysql_query($sql2);
	$i = 0;
	if($rs2){
		while($row2 = mysql_fetch_array($rs2)){
			$i++;
			$ms_mt = $row2[0];
			$ngay_dang1 = $row2['ngay'];
			$noi_dang1 = $row2[6];
			$tieu_de1 = $row2[3];
			$vip = $row2[9];
			$so_lan_xem1 = $row2[10];
?>
	<tr align="center" <?php if($i % 2 == 0) echo 'style="background-color:#f0f0f0;"' ?>>
    	<td><?php echo $ngay_dang1 ?></td>
        <td align="left">
        	<li><a href="dang_tin_rv/update_so_lan_xem.php?ms=<?php echo $ms_mt ?>"><?php echo $tieu_de1 ?></a>(<?php echo $so_lan_xem1 ?> lượt xem)
            <?php
				if($vip == 1){
					echo "<b style='color:red'>-VIP-</b>";	
				}
			?>
        	</li>
        </td>
        <td><?php echo $noi_dang1 ?></td>
    </tr>
<?php
		}
	}
?>
</table><br />
<div align="center"><a href="index.php?noidung=dsmt_rv_v&muc_t=<?php echo $ms_muc_tin ?>">Trở về trang tin rao vặt</a></div>
</div>
